package main

import "fmt"

type human_inter interface {
	say(str string)
}
type student_inter interface {
	human_inter //匿名字段集成接口
	sing(lrc string)
}

type Student7 struct {
	name string
	age  int
}

func (s *Student7) say(str string) {
	fmt.Println(s.name, " say : ", str)
}
func (s *Student7) sing(lrc string) {
	fmt.Println(s.name, " sing: ", lrc)
}
func exe(i student_inter, saystr, singstr string) {
	i.say(saystr)
	i.sing(singstr)
}
func main() {
	var studentinter student_inter

	stu1 := &Student7{"hi", 20}
	//studentinter = stu1
	//结构体的指针实现了对应接口的方法,所以直接用接口接受结构体指针,
	//再用接口触发方法
	studentinter = stu1
	studentinter.say("hi")
	studentinter.sing("hello")
	exe(studentinter, "hi", "hello")
}
